<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>登录</title>
		<link rel="stylesheet" href="js/js/bower_components/bootstrap/dist/css/bootstrap.css" />
		<script src="js/js/bower_components/bootstrap/dist/js/bootstrap.js"></script>
		<script src="js/js/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
		<script src="js/js/jquery-3.4.0.min.js"></script>
		<script>
			$(function(){
				//给登录按钮注入点击事件
				$("#login").click(function(){
					//获取界面输入的值，并且与后端接口进行对接
					console.log("进入登录方法");
					MyUser={
						"username":$("#txtUsername").val(),
						"pwd":$("#txtPwd").val()
					}
					console.log("获取页面当中的值:");
					console.log(MyUser);
					$.ajax({
						type:"put",
						url:"http://localhost:8080/myUser/getAll",
						contentType:"application/json;charset=utf-8",
						data:JSON.stringify(MyUser),
						daraType:"json",
						success:function(res){
							console.log(res);
							if(res.length==1){
								alert("登录成功！");
							}else{
								alert("登录失败，请重新输入！");
							}
						},
						error:function(myError){
							alert("登录失败，请重新输入！");
						}
					});
				})
			})
		</script>
	</head>
	<body>
		<div class="panel-heading"><h2>登录</h2></div>
		<div class="panel-body">
			<div class="input-group">
				<span class="input-group-addon" id="basic-addonl">
					<span class="glyphicon glyphicon-user"></span>
				</span>
				<input type="text" id="txtUsername" name="txtUsername" class="form-control" placeholder="请输入登录账号" />
			</div>
			<br />
			<div class="input-group">
				<span class="input-group-addon" id="basic-addonl">
					<span class="glyphicon glyphicon-lock"></span>
				</span>
				<input type="text" id="txtPwd" name="txtPwd" class="form-control" placeholder="请输入密码" />
			</div>
			<br />
			<div class="btn-group-lg text-right">
				<button id="login" type="button" class="btn btn-success">登录</button>
				<button id="regist" type="button" class="btn btn-default">注册</button>
			</div>
		</div>
	</body>
</html>
